<!-- 体质 -->
<template>
	<view>
		<view class="top"></view>
		<view class="bodys">
			<heads :text="headMsg" :imgUrl="imgUr"></heads>
			<view class="deficiency dis dis1">
				<view class="itemImg contenr">
					<image src="../static/img/icon_4.png" mode="aspectFit" class="imgs listImg"></image>
					<image src="../static/img/icon_2.png" mode="aspectFit" class="imgs listRig"></image>
					<text class="texts">{{result}}</text>
				</view>
			</view>
			<view class="bglisg dis8 contenr">
				<text class="texts">{{template}}</text>
			</view>
			<view class="bar">
				<bar></bar>
				<view class="list_items dis dis3">
					<text>兼有</text>
				</view>
			</view>
		</view>
		<view class="kongs"></view>
		<view class="cont dis8">
			<heads :text="headMsg2" :imgUrl="imgUr1"></heads>
			<block v-for="(item,index) in list" :key="index">
				<view class="items dis8 dis">
					<view class="left">{{item.name}}</view>
					<view class="rigth">{{item.text}}</view>
				</view>
			</block>
		</view>

		<view class="const">
			<heads :text="headMsg3" :imgUrl="imgUr2"></heads>
			<view class="bods">
				<block v-for="(item,index) in good" :key="index">
					<view class="top">
						<image src="../static/img/shengh.png" mode="aspectFit" class="shengh" v-if="item.title=='生活建议'"></image>
						<image src="../static/img/jinji.png" mode="aspectFit" class="shengh" v-if="item.title=='禁忌食物'"></image>
						<image src="../static/img/yins.png" mode="aspectFit" class="shengh" v-if="item.title=='饮食选择'"></image>
					</view>
					<view class="item">
						<view class="items dis" v-for="(i,indexs) in item.goodList" :key="indexs" :class="{'goodList':indexs+1==item.goodList.length}">
							<view class="left contenr">{{i.name}}</view>
							<view class="rigth dis dis2" :class="[indexs==0?'boderItem':indexs+1==item.goodList.length?'boderItem1':'']">{{i.text}}</view>
						</view>
					</view>
				</block>
			</view>
		</view>
		<view class="bottom dis dis2">
			<view class="botmoLeft">
				更多的调理建议，需结合综合症状自检给出，快去自测吧~
			</view>
			<view class="btnsList dis dis1 dis2" @click="goEveryDay">
				<text>健康自测 ></text>
				<!-- <text class="lefts">></text> -->
			</view>
		</view>
	</view>
</template>

<script>
	let app = getApp().globalData;
	import heads from '@/components/head.vue';
	import bar from '@/components/barTo.vue'
	export default {
		components: {
			heads,
			bar
		},
		data() {
			return {
				headMsg: '你的体质类型为：',
				imgUr: '/static/stiati/icon_1.png',
				headMsg2: '具体表现',
				imgUr1: '/static/stiati/icon_8.png',
				headMsg3: '调理建议',
				imgUr2: '/static/stiati/icon_9.png',
				result: '', //体质
				list: [], //具体表现
				template: '', //体质介绍信息
				good: [], //建议
			};
		},
		created() {
			let data = app.resultData;
			let zhengzhuang = JSON.parse(data.zhengzhuang);
			console.log(zhengzhuang)
			let list = [];
			for (let i in zhengzhuang) {
				list.push({
					name: `${i}:`,
					text: zhengzhuang[i]
				})
			}
			console.log(list)
			let good = [];
			let jianyi = data.jianyi
			for (let j in jianyi) {
				let goodList = [];
				for (let z in jianyi[j]) {
					goodList.push({
						name: z,
						text: jianyi[j][z]
					})
				}
				good.push({
					title: j,
					goodList: goodList
				})
			}
			console.log(good)
			this.good = good;
			this.template = data.template;
			this.list = list;
			this.result = data.result;
			console.log(data)
		},
		methods:{
			goEveryDay() {
				uni.redirectTo({
					url: '/second/me/everyday/everyday'
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "../common/css/flex.css";
	@import "../common/css/index.scss";

	.top {
		width: 750upx;
		height: 324upx;
		// background: linear-gradient(180deg, #3CC288 0%, #F8F8F8 100%);
		position: relative;
	}

	.bodys {
		width: 686upx;
		height: 1031upx;
		background: #FFFFFF;
		border-radius: 24upx;
		position: absolute;
		top: 48upx;
		left: 32upx;

		.deficiency {
			width: 622upx;
			height: 150upx;
			margin: auto;

			.itemImg {
				min-width: 284upx;
				height: 112upx;

				margin-top: 9upx;
				position: relative;

				.imgs {
					position: absolute;
					width: 36upx;
					height: 22upx;
				}

				.listImg {
					top: 0;
					left: -25upx;
				}

				.listRig {
					bottom: 0;
					right: -35upx;
				}

				.texts {
					font-size: 80upx;
					font-family: $typeface;
					font-weight: 500;
					color: #3CC288;
				}
			}
		}

		.bglisg {
			width: 622upx;
			height: 144upx;
			// background: #F8F8F8;
			// border-radius: 16upx;
			margin-top: 18upx;
			font-size: 28upx;
			font-family: $typeface1;
			font-weight: 400;
			color: #666666;
			background: #FFFFFF;
			box-shadow: 0px 6upx 28upx 0px rgba(0, 0, 0, 0.07);
			border-radius: 16upx;
			border: 1px solid #F2F2F2;

			.texts {
				margin-left: 24upx;
				margin-right: 36upx;
			}
		}

		.bar {
			width: 614upx;
			height: 550upx;
			margin: auto;
			margin-top: 20upx;
			position: relative;

			.list_items {
				width: 120upx;
				height: 60upx;

				position: absolute;
				bottom: 10upx;
				right: 165upx;
				font-size: 22upx;
				font-family: $typeface;
				font-weight: 500;
				color: #999999;
			}
		}
	}

	.kongs {
		width: 100%;
		height: 800upx;
		// border: 1px solid red;
	}

	.cont {
		width: 686upx;
		min-height: 375upx;
		background: #FFFFFF;
		border-radius: 24upx;
		padding-bottom: 32upx;

		.items {
			width: 594upx;
			min-height: 40upx;
			margin: 20upx auto;

			.left {
				width: 140upx;
				height: 100%;
				font-size: 28upx;
				font-family: $typeface;
				font-weight: 500;
				color: #333333;
			}

			.rigth {
				width: 454upx;
				height: 100%;
				font-size: 28upx;
				font-family: $typeface1;
				font-weight: 400;
				color: #666666;
			}
		}
	}

	.const {
		width: 686upx;
		min-height: 495upx;
		background: #FFFFFF;
		border-radius: 24upx;
		padding-bottom: 32upx;
		margin: 32upx auto;
		padding-bottom: 56upx;
		.bods {
			width: 622upx;
			margin: auto;
			min-height: 480upx;

			.top {
				width: 622upx;
				height: 40upx;
				margin-top: 32upx;

				.shengh {
					width: 135upx;
					height: 100%;
				}
			}

			.item {
				width: 100%;
				min-height: 100upx;
				border: 1px solid #EAEAEA;
				border-radius: 0px 16upx 16upx 16upx;
				background-color: #FFF8F2;
				.items {
					width: 100%;
					// min-height: 80upx;
					border-bottom: 1px solid #DFDFDF;
					.left {
						width: 158upx;
						font-size: 28upx;
						font-family: $typeface;
						font-weight: 500;
						color: #333333;
					}

					.rigth {
						width: 464upx;
						min-height: 80upx;
						background: #FFFFFF;
						font-size: 28upx;
						font-family: $typeface1;
						font-weight: 400;
						color: #837364;
						padding: 20upx 20upx;
						
					}
					.boderItem{
						border-radius: 0px 16upx 0upx 0upx;
					}
					.boderItem1{
						border-radius: 0px 0upx 16upx 0upx;
					}
				}

				.goodList {
					border: none;
				}
			}
		}
	}

	.bottom {
		width: 686upx;
		height: 130upx;
		background: #FFFFFF;
		border-radius: 24upx;
		margin: auto;
		margin-bottom: 50upx;

		.botmoLeft {
			width: 394upx;
			margin-left: 32upx;
			font-size: 26upx;
			font-family: $typeface;
			font-weight: 400;
			color: #333333;
		}

		.btns {
			width: 179upx;
			height: 56upx;
			margin-left: 49upx;
		}
	}

	.btnsList {
		width: 174upx;
		height: 56upx;
		background: #FFD344;
		border-radius: 48upx;
		margin-left: 26upx;
		font-size: 26upx;
		font-family: $typeface;
		font-weight: 500;
		color: #333333;
		// .lefts{
		// 	width: 12upx ;
		// 	height: 12upx;
		// }
	}
</style>
